<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>JS中5种数据类型</title>
</head>
<body>
<script>
    // number: 数值型, 整数和小数都行
    let a = 10;
    document.write(a + ": " + typeof(a) + "<br/>");
    let b = 6.66;
    document.write(b + ": " + typeof(b) + "<br/>");

    // boolean: true/false
    let c = true;
    document.write(c + ": " + typeof(c) + "<br/>");

    // string: 字符串 在js中""包裹的内容和''包裹的内容都是字符串.
    let str1 = "你不要乱来";
    document.write(str1 + ": " + typeof(str1) + "<br/>");
    let str2 = '乱来!';
    document.write(str2 + ": " + typeof(str2) + "<br/>");

    // object: 对象类型
    // 自定义JS对象: {键1:值1, 键2:值2}
    let person = {name: "张三", age: 18};
    document.write(person + ": " + typeof(person) + "<br/>");

    // null表示对象类型, null是对象类型的默认值.
    let x = null;
    document.write(x + ": " + typeof(x) + "<br/>");

    // undefined: 未定义 没有给变量赋值
    let y;
    document.write(y + ": " + typeof(y) + "<br/>");
</script>

</body>
</html>